import http from "@/http";

//根据商品名称或货号模糊查询
export const ApiProductBy = (params: IAdminListParams): RES<IModel<IProduct>> =>
  http.get(`/product/simpleList`, { params });

// 创建商品
export const ApiAddProduct = (params: IAddProductParams): RES<number> =>
  http.post(`/product/create`, params);

// 查询所有一级分类及子分类
export const ApiCategoryWithChildren = (): RES<IGetProductCage[]> =>
  http.get(`/productCategory/list/withChildren`);

// 获取全部品牌列表
export const ApiBrandWithChildren = (): RES<IBrandData[]> =>
  http.get(`/brand/listAll`);

// /productAttribute/category/list
// 分页获取所有商品属性分类
export const ApiProductAttribute = (params: {
  pageNum: number;
  pageSize: number;
}): RES<IProductAttribute> =>
  http.get(`/productAttribute/category/list`, { params });

// /subject/listAll
// 获取全部商品专题
export const ApiSpecial = (): RES<ISpecial[]> => http.get(`/subject/listAll`);

// /prefrenceArea/listAll
// 获取所有商品优选
export const ApiPrefrenceArea = (): RES<IPrefrenceArea[]> =>
  http.get(`/prefrenceArea/listAll`);
